package com.longge;

import java.util.Arrays;
import java.util.HashSet;

public class ReverseVowels {


    public String reverseVowels(String s) {

        char[] chars = s.toCharArray();
        HashSet<Character> set = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'));

        int left = 0, right = chars.length - 1;
        while (left < right) {
            if (set.contains(chars[left]) && set.contains(chars[right])) {
                char temp = chars[left];
                chars[left] = chars[right];
                chars[right] = temp;
                left++;
                right--;
            } else if (set.contains(chars[left])) {
                right--;
            } else if (set.contains(chars[right])) {
                left++;
            } else {
                left++;
                right--;
            }
        }
        return new String(chars);

    }

    public static void main(String[] args) {
        String str = "https://cbs-internal-test-image02.obs.cn-north-4.myhuaweicloud.com:443/picture/670545.jpg";
        String path = "picture/";
        System.out.println(path+str.substring(str.lastIndexOf("/") + 1));

    }


}
